import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    islogin: sessionStorage.getItem("islogin"), //保存当前页面是有用户登录
    uid: sessionStorage.getItem("uid"),
    phone:sessionStorage.getItem("phone"),
    uname:sessionStorage.getItem("uname"),
    token:sessionStorage.getItem("token"),
    province:sessionStorage.getItem("province"),
    selected:'page'
  },
  mutations: {
    loginOK(state, uid,phone,uname) {
      state.islogin = true; //设置为登录状态
      state.uid = uid;
      state.phone = phone;
      state.uname = uname;
      console.log(state, uid);
    },
    //注销
    logout(state,uid,phone){
      state.islogin = false; //设置为未登录状态
      state.uid = uid;
      state.phone = phone;
    },
    changs(selected){
      state.selected = selected
    }

  },
  actions: {},
  modules: {}
})